package com.utils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

//这是tset分支
public class Test {
    public static void main(String[] args) throws SQLException {
        Connection hiveConn = HiveUtils.getHiveConn();
        System.out.println(hiveConn);

        String tabName=args[0];
        int ct=Integer.parseInt(args[1]);
        PreparedStatement pre = hiveConn.prepareStatement("select * from "+tabName +" limit 10");
        ResultSet resultSet = pre.executeQuery();
        while (resultSet.next()) {
            for (int i = 0; i < ct; i++) {
                if (i==ct-1){
                    System.out.println(resultSet.getObject(i+1));
                    break;
                }
                System.out.print(resultSet.getObject(i+1)+",");
            }
        }
        resultSet.close();
        pre.close();
        hiveConn.close();
    }
}
